﻿using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;

namespace IBaseService
{
    public interface IBaseService<TEntity, TVo> where TEntity : class where TVo : class
    {
        ISqlSugarClient Db { get; }
        public Task<TVo> GetByIdAsync(int id);
        public Task<List<TVo>> GetAllAsync();
        public Task<int> addAsync(TVo vo);
        public Task<int> updateAsync(TVo vo);
        public Task<int> deleteAsync(TVo vo);
        //老师代码部分
        Task<long> Add(TEntity entity);
        Task<List<long>> AddSplit(TEntity entity);
        Task<List<TVo>> Query(Expression<Func<TEntity, bool>>? whereExpression = null);
        Task<List<TEntity>> QuerySplit(Expression<Func<TEntity, bool>> whereExpression, string orderByFields = null);
        Task<List<TVo>> QueryWithCache(Expression<Func<TEntity, bool>>? whereExpression = null);
    }
}
